<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="view/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="view/toastr/toastr.min.css" rel="stylesheet">
<link href="view/css/oneplus.css" rel="stylesheet">
<script type="text/javascript" src="view/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="view/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="view/js/tox.js"></script>
<script type="text/javascript" src="view/toastr/toastr.js"></script>
</head>
<body style="background-color:F1F1F1">
	<div class="container">
		<div class="row">
			<section>
			<div class="col-xs-9 login">
				<div class="col-md-6 col-xs-12 lg_left">
					<div class="col-xs-12">
						<div class="col-xs-11 col-xs-offset-1 lg_lf_top">
							<a href="/tox/home/index/index.html" title="首页"
								style="font-size: 18px">欢迎回到 JavaTOX ！</a>
						</div>
						<div class="clearfix"></div>
						<div class="lg_lf_form ">
							<div class="form-group">
								<label for="username" class=".sr-only col-xs-12"></label>
								<div class="col-xs-12 col-xs-offset-1">
									<input type="text" class="form-control" id="username"
										name="username" style="height: 34px;font-size:14px"
										placeholder="请输入用户名">
								</div>
								<div class="clearfix"></div>
							</div>
							<div class="form-group">
								<label for="password" class=".sr-only col-xs-12"></label>
								<div class="col-sm-12 col-xs-offset-1">
									<div class="input-group">
										<input type="password" class="form-control" id="password"
											style="height: 34px;font-size:14px" name="password"
											placeholder="请输入密码">
										<div class="input-group-addon">
											<a style="width: 100%;height: 100%"
												href="javascript:void(0);" onclick="change_show(this)">show</a>
										</div>
									</div>
								</div>
								<div style="margin-left: 30px;">
									<a class="btn btn-link" href="/tox/home/user/mi.html"
										style="color: #848484;font-size: 12px;">忘记密码？</a>
								</div>
								<div class="clearfix"></div>
							</div>
							<div class="form-group">
								<label for="verifyCode" class=".sr-only col-xs-12"
									style="display: none"></label>
								<div class="col-xs-12 col-md-5 col-xs-offset-1">
									<input type="text" class="form-control" id="security"
										style="height: 34px;font-size:14px" name="securityCode"
										placeholder="验证码">
								</div>
								<div class="col-xs-12 col-md-6 lg_lf_fm_verify">
									<img class="verifyimg reloadverify  "
										src="Security/SecurityCodeImageAction" id="Verify"
										style="cursor:hand;" alt="看不清，换一张" />
									<div
										class="col-xs-12 Validform_checktip text-warning lg_lf_fm_tip col-xs-offset-1"></div>
								</div>
								<div class="clearfix"></div>
							</div>
							<div class="checkbox lg_lf_fm_checkbox col-xs-offset-1">
								<label> <input type="checkbox" name="remember"
									style="cursor:pointer;"> 记住登录 </label>
							</div>

							<button id="logins" class="btn btn-default pull-right"
								style="margin-right: -15px;" type="submit">登录</button>
						</div>
					</div>
				</div>
				<!-- 右侧 -->
				<div class="col-md-6 col-xs-12">
					<div class="hidden-xs hidden-sm lg_center"></div>
					<div class="hidden-xs hidden-sm" style="margin: 21px 0 16px 40px;">
						<img class="img-responsive"
							src="http://www.thinkox.com/tox/Public/Home/images/login_img.png"
							alt="">
					</div>

					<div style="margin-top: 35px;">
						<span class="other_login_title">合作登录：</span>
						<div class="other_login_link"></div>
					</div>
				</div>
				<!-- 底部 -->
				<div class="col-xs-12 lg_bottom_top" style="font-size: 14px">
					<span>还没有账户&nbsp;?&nbsp; &nbsp; <a
						href="${pageContext.request.contextPath}/home/register.jsp"
						title="">立即注册</a> </span>
				</div>
				<div class="col-xs-12 lg_bottom_bottom">
					<span>@2014. All Rights Reserved</span>
				</div>
			</div>
			</section>
		</div>


	</div>


</body>
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$("#logins").click(
								function() {
									var username = $("#username").val().trim();
									var password = $("#password").val().trim();
									varsecurityCode = $("#security").val()
											.trim();
									if (validateForm_login()) {
										var params = $("input").serialize();
										$.ajax({
											type : "post",
											data : params,
											url : "login.action",
											success : function(data) {
												var jsonObject = eval("("
														+ data + ")");
												if (jsonObject["success"]) {
													setTimeout(function(){
														window.location="/JavaTox/Weibo/weibolist.action";
													},1500);
													toast.success("欢迎回来，页面正在跳转，请稍候。",
															"温馨提示");
												}else{
													toast.error(jsonObject["message"],"温馨提示");
												}

											},
											error : function() {
												alert("请求错误");
											}
										});
									}

								});
						$("#Verify").click(
								function() {
									$(this).attr(
											"src",
											"Security/SecurityCodeImageAction?timestamp="
													+ new Date().getTime());
								});
						function change_show(obj) {
							if ($(obj).text().trim() == 'show') {
								var value = $('#password').val().trim();
								var html = '<input type="text" value="'+value+'" id="password" class="form-control" placeholder="请输入密码"name="password">'
										+ '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">hide</a></div>';
								$('#password_block').html(html);
							} else {
								var value = $('#password').val().trim();
								var html = '<input type="password" value="'+value+'" id="password" class="form-control" placeholder="请输入密码"  name="password">'
										+ '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">show</a></div>';
								$('#password_block').html(html);
							}
						}
					});
</script>
</html>
